package com.hanthink.web.controller.app.resourcecall;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hanthink.common.constant.HttpStatus;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.domain.model.LoginUser;
import com.hanthink.common.core.page.TableDataInfo;
import com.hanthink.common.utils.ServletUtils;
import com.hanthink.framework.web.service.TokenService;
import com.hanthink.system.domain.resourcecall.CallRecordInfo;
import com.hanthink.system.domain.resourcecall.ResourceCallInfo;
import com.hanthink.system.service.resourcecall.IResourceCallInfoService;

@RestController
@RequestMapping("/app/resourcecall/resourceCallInfo")
public class ResourceCallInfoControll extends BaseController {

	@Autowired
	private IResourceCallInfoService resourceCallInfoService;
	

	// 查询设备名称
	@PostMapping("/equipDesc")
	public TableDataInfo queryEquipDesc(@RequestBody ResourceCallInfo info) {
		startPage();
		ResourceCallInfo tmp = resourceCallInfoService.selectEquipDescByEquipName(info);
		List<ResourceCallInfo> list = new ArrayList<ResourceCallInfo>();
		list.add(tmp);
		return getDataTable(list);
	}

	// 查询下拉框数据
	@PostMapping("/listFault")
	public TableDataInfo listFault(@RequestBody ResourceCallInfo info) {
		startPage();
		List<ResourceCallInfo> list = resourceCallInfoService.selectListOfResourceCall(info);
		return getDataTable(list);
	}

	// 保存
	@PostMapping("/save")
	public TableDataInfo save(@RequestBody CallRecordInfo info) {
		resourceCallInfoService.save(info);
		TableDataInfo rspData = new TableDataInfo();
		rspData.setCode(HttpStatus.SUCCESS);
		rspData.setMsg("保存成功");
		return rspData;
	}
}
